package com.hjl.controller;

import com.hjl.pojo.vo.PortalVo;
import com.hjl.service.HeadlineService;
import com.hjl.service.TypeService;
import com.hjl.service.UserService;
import com.hjl.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author ServivE
 * @version 0.1
 * @className PortalController
 * @description 首页的控制层
 * @date 2024/8/22 20:09
 * @since jdk17
 */
@RestController
@RequestMapping("portal")
@CrossOrigin
public class PortalController {
    @Autowired
    private TypeService typeService;
    @Autowired
    private HeadlineService headlineService;

    //查询所有分类的数据
    @GetMapping("findAllTypes")

    public Result findAllTypes() {
        Result result = typeService.findAllTypes();
        return result;
    }

    //    分页查询首页头条信息
    @PostMapping("findNewsPage")
    public Result findNewsPage(@RequestBody PortalVo portalVo) {
        Result result = headlineService.findNewsPage(portalVo);
        return result;
    }

    //查看全文详情
    @PostMapping("showHeadlineDetail")
    public Result showHeadlineDetail(int hid) {
        Result result = headlineService.showHeadlineDetail(hid);
        return result;
    }
}
